home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-1097 / AMOSLIST / text0044.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  1.6 KB  |  57 lines

  1. The man most directly responsible for this twaddle was Peter Falkesand, who
  2. did thus comment on Sorting routine. on the night of 03-Oct-97:
  3. -> Hi!
  4.  
  5. -> Is there a smooth way to sort 20 variables???
  6.  
  7. -> and not do like this..
  8.  
  9. -> --------------------------------
  10.  
  11. -> If score1_1(1)>score2_1(1)
  12.  
  13. -> Loke S7+40,Leek(S5+20)
  14.  
  15. -> endif
  16.  
  17. -> if score1_2(2)>score2_1(1)
  18.  
  19. -> loke s7+60,leek(s5+40)
  20.  
  21. -> endif
  22.  
  23. -> -------------------------------
  24.  
  25. Hmm, i have never *ever* tried to do it this way, it would be wayyy to big.
  26. Twinz used a high score table of 3 sets of 10 positions, and i'll go get the
  27. source and paste it into here...
  28.  
  29.       For N=1 To 10
  30.          TP=TSCORE(N)
  31.          If SCORE>TP : Rem or N=2 
  32.             For O=10 To N Step -1 : TSCORE(O)=TSCORE(O-1) :
  33. TSCORE$(O)=TSCORE$(O-1) : Next O
  34.             TSCORE(N)=SCORE : TSCORE$(N)=TEX$
  35.          End If 
  36.       Next N
  37.  
  38. The routine finds the position of the highest point in the table it can go (if
  39. any) by running through all possible entries, and its higher value will be
  40. first, and N will be loaded with the current slightly-lower value.
  41.  
  42. The second part of the routine, shuffles them all down by 1 position, from 1
  43. to
  44. 2, 2 to 3 etc. and inserts the value in SCORE in the correct space.
  45.  
  46. Andrew "Mushroom" Kellett
  47. --
  48.  Email: Andy Kellett <mushypd@redrose.net>  Team *AMOS* + IAPA Team *AMIGA*
  49.   alt.religion.amos - AMOS now on usenet! AMOS Mailinglist also mirrored
  50.  
  51.      World's Largest AMOS Homepages - http://www.mushy-pd.demon.co.uk
  52.  
  53.          Massive FTP site with AMOS/C64 and Mods/Samples + more at
  54.                             mushy-pd.dyn.ml.org
  55.  
  56.  
  57.